import time

from faker import Faker
from selenium.webdriver.common.by import By

from xinan_ui.proxy.jdz.dbbr_jdz import DbBuyJdz
from xinan_ui.proxy.jdz.dbmc_jdz import DbSellJdz
from xinan_ui.proxy.jdz.enter_first import EnterFirst
from xinan_ui.proxy.jdz.enter_tjd import EnterTjd
from xinan_ui.proxy.jdz.lr_login import LRLogin

from xinan_ui.proxy.jdz.phone_jdz import PhoneJdzLogin
from xinan_ui.proxy.jdz.pt_buy import PtBuy
from xinan_ui.proxy.jdz.pt_login import PtLogin
from xinan_ui.proxy.jdz.pt_sell import PtSell
from xinan_ui.proxy.jdz.rq_jdz import RqSellJdz
from xinan_ui.proxy.jdz.rz_jdz import RzBuyJdz
from xinan_ui.proxy.jdz.tid_fdmr import Ftmr
from xinan_ui.proxy.jdz.tjd_hlmc import TjdHlmc
from xinan_ui.tools.App_driver import AppDriver01
from xinan_ui.tools.read_yml_xn import ReadYaml
from xinan_ui.tools.swipe_pro import SwipeTool
import random
devices_data=ReadYaml(r'D:\testLi\PythonWork\xinan_ui\config\devices.yml').read_yaml()['sanxing_jdz']
print(devices_data)
driver=AppDriver01().get_driver(port=4723,desired_caps=devices_data)


EnterFirst(driver).enter_fir()
# faker = Faker("zh_CN")
# phone = faker.phone_number()
# print(phone)
# time.sleep(1)
b="15650036"
a=random.randint(100,999)
print(b+str(a))
phone=b+str(a)
PhoneJdzLogin(driver).phone_login(phone)
# PtLogin(driver).pt_login("181001508","111111")
# LRLogin(driver).lr_login("991901268","111111")
# time.sleep(3)
# EnterTjd(driver).enter_tjd('信用')
# d=Ftmr(driver).ftmr('600000')
# print(d)
# time.sleep(1)
# d1=TjdHlmc(driver).hlmc('600004')
# print(d1)

# driver.find_element(By.XPATH,"""//android.widget.RelativeLayout[@content-desc="首页"]/android.widget.TextView""").click()
# time.sleep(1)
# for i in range(3):
#     SwipeTool(driver).get_left()
# time.sleep(1)
# driver.find_element(By.XPATH,"""
# (//android.widget.ImageView[@content-desc="西南金点子"])[5]""").click()
# LRLogin(driver).lr_login("992000023","111111")
# time.sleep(1)
# d2=RqSellJdz(driver).rq_jdz('600000',200)
# print(d2)
# d3=DbBuyJdz(driver).db_buy_jdz('600000',200)
# print(d3)
# d4=DbSellJdz(driver).db_sell_jdz('600000',200)
# print(d4)


# d=PtSell(driver).pt_sell("000001",200)
# print(d)
# PtBuy(driver).pt_buy("000001",200)

# SwipeTool(driver).get_on()
# time.sleep(2)
# SwipeTool(driver).get_down()
# print('向下滑动')